﻿using System.Collections.Generic;
using System.Runtime.Remoting.Messaging;

namespace VideoStore.Common.Response.Extension
{
    public static class ResponseExtension
    {
        /// <summary>
        /// Adds the successful save message.
        /// </summary>
        /// <param name="messageList">The message list.</param>
        /// <param name="objectName">Name of the object.</param>
        public static void AddSuccessfulSaveMessage(this List<Message> messageList, string objectName)
        {
            messageList.Add(new Message(objectName, "Was successfully saved."));
        }

        /// <summary>
        /// Adds the fatal error.
        /// </summary>
        /// <param name="errorList">The error list.</param>
        /// <param name="errorMessage">The error message.</param>
        public static void AddFatalError(this List<Error> errorList, string errorMessage)
        {
            errorList.Add(new Error("Fatal error occured.", errorMessage));
        }
    }
}
